<template>
    <view class="successBoxPage">
        <view class="iconBox">
           <!-- <image :src="url+'/static/my/sign.success.png'"  mode=""></image> -->
		   <view class="boxBanner">
				<image src="/static/newsImg/boxBg.png"  mode="widthFix"></image>
		   </view>
		    <image class="iconImg" :src="url+'/static/my/sign.success.png'"  mode=""></image>
            <text class="iconWord">支付成功</text>
        </view>
		 <view class="btn" @click="repaymentSu">返回</view>
    </view>
</template>

<script>
	var goldPlan = require('../../../../common/jgoldplan-1.0.0.js');
	import api from '@/api/api.js'
    export default {
        data() {
            return {
               num: 0, 
               data: {},
			   url:'',
            }
        },
		props:{
		  orderId: String,
		},
        created(){
			this.url = this.domainName
           // this.getPayResult(this.orderId)
        },
        methods: {
            async getPayResult(id){
            	// console.log(id)
            	var _this = this
            	uni.showLoading({
            		title:'加载中'
            	})
            	try{
            		var res = await this.$api.getDonationPayResult(this.orderId)
            		if(res.result != ''){
            			  this.data = res.result
            			  uni.hideLoading()
            		}else{
            			if(this.num < 20){
            				setTimeout(res=>{
            					 _this.num++
            					 _this.getPayResult(this.orderId)
            				},1000)
            			}else{
            				uni.hideLoading()
            			}
            		}
            	}catch{
            		uni.hideLoading()
            	}
            },
			repaymentSu(){
				var mchData = {
					action: 'jumpOut',
					jumpOutUrl: this.url+'/pages/pay/blindbox?orderId='+this.orderId //跳转的页面
				}				
				var pData = JSON.stringify(mchData);
				parent.postMessage(pData, 'https://payapp.weixin.qq.com')
				
			}
        }
    }
</script>

<style scoped>
.successBoxPage{
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
	width: 100%;
}
.iconBox {
    margin-top: 50rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
	width: 100%;
}
.iconImg{
	margin-top: 120rpx;
	width: 152rpx;
	height: 152rpx;
	border-radius: 50%;
}
.iconWord{
	margin-top: 40rpx;
	font-size: 36rpx;
	color: #222222;
}
.boxBanner{
	width: 100%;
}
.boxBanner image{
    width: 100%;
    height: 100%;
}
.btn{
    width: 320rpx;
    height: 80rpx;
    border: 2rpx solid #1085F2;
    text-align: center;
    line-height: 80rpx;
    color: #0B87F2;
    border-radius: 80rpx;
    margin-top: 80rpx;
}
</style>
